package com.golf.core.game.score;

/**
 * An immutable score counter.
 * 
 * @author gareth
 */
public class Score
{
    
    /** The course name associated with this score. */
    private final String courseName;
    
    /** The score value. */
    private Integer score = Integer.valueOf(0);
    
    
    /**
     * Create a score for a given course.
     * 
     * @param courseName The course name.
     */
    public Score(final String courseName)
    {
        this.courseName = courseName;
    }
    
    
    /**
     * Get the course name.
     * 
     * @return The name of the course.
     */
    public String getCourseName()
    {
        return courseName;
    }
    
    
    /**
     * Increment the current score by one.
     */
    public synchronized void increase()
    {
        score = Integer.valueOf(score.intValue() + 1);
    }
    
    
    /**
     * Get the current score.
     * 
     * @return The current score.
     */
    public synchronized int getScore()
    {
        return score.intValue();
    }

}